package com.demo.arthas.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Random;

/**
 * @author peter
 * @date 2022/2/24 22:02
 */
@RestController
public class HeapOOMController {

    @GetMapping("/test/add")
    public void testAdd() {
        // 使用之前确保添加启动参数VM Options -Xms300m -Xmx300m限制内存使用
        ArrayList<Integer> num = new ArrayList<>();

        while (true) {
            Random random = new Random();
            int i = random.nextInt(100);
            num.add(i);
        }
    }
}
